package com.example.service;

import com.example.entity.MedicalBasicInfo;
import com.example.mapper.MedicalBasicInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MedicalBasicInfoService {

    @Autowired
    private MedicalBasicInfoMapper medicalBasicInfoMapper;

    public void addMedicalBasicInfo(MedicalBasicInfo info) {
        medicalBasicInfoMapper.insert(info);  // 新增医疗基本信息
    }

    public MedicalBasicInfo getMedicalBasicInfoById(int id) {
        return medicalBasicInfoMapper.selectById(id);  // 查询医疗基本信息
    }

    public List<MedicalBasicInfo> getAllMedicalBasicInfo() {
        return medicalBasicInfoMapper.selectList(null);  // 查询所有医疗基本信息
    }

    public void updateMedicalBasicInfo(MedicalBasicInfo info) {
        medicalBasicInfoMapper.updateById(info);  // 更新医疗基本信息
    }

    public void deleteMedicalBasicInfo(int id) {
        medicalBasicInfoMapper.deleteById(id);  // 删除医疗基本信息
    }
}
